<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</meta>
<style type="text/css">
    *{
        margin: 0px;
        padding: 0px;
    }
    .maxBox{
        width: 1000px;
        margin:auto;
        height:auto;
        margin-top:0px;

    }
    .td_height{
        height:24px;
    }
    .data{
        text-align: right;
        width: 80px;
    }
    .data_td{
        width: 160px;
        text-align: left;
    }
    .table1 tr td{ text-align:center;border:1px solid #000;}
</style>
<body>
<div>
    <button onclick="print_prepackage(this)" class="btn btn-info">打印</button>
</div>
<div class="maxBox">
    <?php foreach($results as $_result){?>
    <center><h3 style="font-size:24px;">有棵树科技产品质检报告单</h3></center>
    <table summary="" style="float:right;margin-bottom:5px;" >
        <tr>
            <td class="data">日期：</td>
            <td class="data_td"><?php echo date('Y-m-d H:i:s'); ?></td>
        </tr>
        <tr>
            <td class="data">凭证单号：</td>
            <td class="data_td"><?php echo $_result['evidence']; ?></td>
        </tr>
    </table>
    <?php
	$result=$_result['result'];
	$num = count($result);
	$j=0;
	$k=0;//当订单有七八十来个的时候，$k>1的时候就的加分页
    $counter=intval($num/5);
    for($i=0;$i<=$counter;$i++){

    if((!isset($result[$j]['purchaseorder_id']))||$result[$j]['purchaseorder_id']==''){
    if($i==$counter){?>
    <div style="overflow:hidden;">
        <span style="float:left;margin-right:10px;margin-top:10px; margin-left:200px;">审核人:</span>
        <span style="float:right; margin-right:180px; margin-top:10px;">
			经办人:  <?php echo $_SESSION['current_account']['remark'];?>  </span></div>
    <?php }
		continue;
	}?>
    <?php if($num>5&&$k>0){?><div style="page-break-after:always;"></div><?php }?>
    <table class="table1" border="1" cellSpacing="1"  style="margin-top:5px;font-size:18px;border-collapse:collapse;" cellpadding="0" cellspacing="0" width="1000px">
        <tr>
            <td rowspan="2" class="td_height">序号</td>
            <td rowspan="2" class="td_height" style="width:90px;">采购订单号</td>
            <td rowspan="2" class="td_height" style="width:65px;">采购员</td>
            <td rowspan="2" class="td_height">SKU</td>
            <td rowspan="2" class="td_height">采购名称</td>
            <td rowspan="2" class="td_height">报关品名</td>
            <td rowspan="2" class="td_height">所属仓库</td>
            <td rowspan="2" class="td_height" style="width:80px;">到货数量</td>
            <td rowspan="2" class="td_height" style="width:80px;">入库数量</td>
            <td rowspan="2" class="td_height" style="width:100px;">不合格数量</td>
            <td colspan="2" class="td_height" style="width:80px;">总可用库存</td>
            <td rowspan="2" class="td_height">问题原因</td>
            <td rowspan="2" class="td_height">备注</td>
        </tr>
        <tr>
            <td>出口退税</td>
            <td>非出口退税</td>
        </tr>
        <?php	for($z=0;$z<5;$z++){if((!isset($result[$j]['purchaseorder_id']))||$result[$j]['purchaseorder_id']=='')continue;?>
        <tr>
            <td class="td_height"><?php echo $j+1; ?></td>
            <td><?php echo $result[$j]['purchaseorder_id']; ?></td>
            <td><?php echo $users[$result[$j]['purchase_id']]; ?></td>
            <td><?php echo $result[$j]['sku']; ?></td>
            <td><?php echo $result[$j]['sku_name']; ?></td>
            <td><?php echo $result[$j]['item']; ?></td><!-- 报关品名-->
            <td><?php echo $result[$j]['transfer_hopper_name']; ?></td>
            <td><?php echo $result[$j]['check_quantity']; ?></td>
            <td><?php echo $result[$j]['qualified_quantity']; ?></td>
            <td><?php echo $result[$j]['unquality_count'];?></td>
            <td><?php echo $result[$j]['tax_all_available_num']['all_available_num'];?></td>
            <td><?php echo $result[$j]['all_available_num']['all_available_num'];?></td>
            <td><?php echo $result[$j]['check_remark']; ?></td>
            <td></td>
        </tr>
        <?php $j++;}?>
    </table>
    <?php if($i==$counter){?><div style="overflow:hidden;">
    <span style="float:left;margin-right:10px;margin-top:10px; margin-left:200px;">审核人:</span>
    <span style="float:right; margin-right:180px; margin-top:10px;">
	经办人:  <?php echo $_SESSION['current_account']['remark'];?>  </span></div><?php }?>

    <?php $k++;}?>
    <div style="page-break-after:always;"></div>
    <!--<div class="PageNext"></div>-->
    <?php }?>
</div>
</body>
</html>
<style>
    .btn {
        display: inline-block;
        padding: 5px 12px;
        margin-bottom: 0;
        font-family: "Helvetica Neue", Helvetica, Tahoma, Arial, 'Microsoft Yahei', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif;
        font-size: 13px;
        font-weight: normal;
        line-height: 1.53846154;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        cursor: pointer;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        -o-user-select: none;
        user-select: none;
        background-image: none;
        border: 1px solid transparent;
        border-radius: 4px;
        -webkit-transition: all .4s cubic-bezier(.175, .885, .32, 1);
        transition: all .4s cubic-bezier(.175, .885, .32, 1);
    }
    .btn:focus {
        outline: thin dotted #333;
        outline: 5px auto -webkit-focus-ring-color;
        outline-offset: -2px;
    }
    .btn:hover,
    .btn:focus {
        color: #353535;
        text-decoration: none;
    }
    .btn:active,
    .btn.active {
        background-image: none;
        outline: none;
        box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125)
    }
    .btn-info {
        color: #fff;
        text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
        background-color: #03b8cf;
        border-color: #03a2b6;
    }
</style>
<script>
    function print_prepackage(thisObj)
    {
        thisObj.parentNode.style.display='none';
        window.print();
        thisObj.parentNode.style.display='block';
    }
</script>